import QtQuick 2.6
import QtQuick.Layouts 1.1

import "../../../../Base/UiBase"
import "../../../../Base/Config"

Rectangle {
    id: root
    signal commentPageClicked
    property bool upActivated: false
    property int upNumber: 0

    width: parent.width
    height: 50 * Size.ratio
    color: Color.foregroundDarker

    RowLayout {
        anchors.fill: parent
        spacing: 0
        MouseArea {
            id: favoriteButton

            property bool activated: false

            Layout.fillHeight: true
            Layout.preferredWidth: parent.width / 3
            onClicked: activated = !activated

            Image {
                sourceSize.width: 118 * Size.ratio
                sourceSize.height: 50 * Size.ratio
                anchors.centerIn: parent
                source: favoriteButton.activated ? "../../../../../resources/tcommunity/posts/shoucang02.svg" : "../../../../../resources/tcommunity/posts/shoucang01.svg"
            }
            RightDivider {
                height: parent.height * 0.75
                anchors.verticalCenter: parent.verticalCenter
            }
        }

        MouseArea {
            Layout.preferredWidth: parent.width / 3
            Layout.fillHeight: true

            onClicked: upNumber = (root.upActivated = !root.upActivated)
            Image {
                id: upButton

                height: 50 * Size.ratio
                width: 118 * Size.ratio
                anchors.centerIn: parent

                source: root.upActivated ? "../../../../../resources/tcommunity/posts/zan02.svg" : "../../../../../resources/tcommunity/posts/zan01.svg"

                Text {
                    id: upNumberLabel

                    anchors {
                        verticalCenter: parent.verticalCenter
                        left: parent.right
                        leftMargin: -47 * Size.ratio
                    }

                    font.pixelSize: Size.smallFont

                    text: String(root.upNumber)
                }
            }
            RightDivider {
                height: parent.height * 0.75
                anchors.verticalCenter: parent.verticalCenter
            }
        }

        MouseArea {
            id: commentPageButton

            property bool activated: false

            Layout.fillHeight: true
            Layout.preferredWidth: parent.width / 3

            onClicked: {
                commentPageClicked()
                activated = !activated
            }
            Image {
                id: submitCommentButton

                height: 50 * Size.ratio
                width: 118 * Size.ratio
                anchors.centerIn: parent

                source: commentPageButton.activated ? "../../../../../resources/evaluation/multi/paint/pingfen02.svg" : "../../../../../resources/evaluation/multi/paint/pingfen01.svg"
            }
        }
    }

}
